<div id="desktopBar">

<?php
	$lang_url = base_url().Settings::get_lang('current').'/'.Settings::get('admin_url');
?>
<?php if (ENVIRONMENT == 'development' OR ENVIRONMENT == 'testing'): ?>
	
	<script type="text/javascript">
		ION.initLabelHelpLinks('#preprod-flag');
	</script>
<?php endif; ?>

<a id="logoAnchor" class="navlink" href="dashboard"></a>
<div class="desktopTitlebarWrapper">
	<div class="desktopTitlebar">
		<h1 class="applicationTitle">ionize <?php echo($this->config->item('version')) ;?></h1>
		<div class="topNav">
			<ul class="menu-right">
				<li><?php echo lang('ionize_logged_as'); ?> : <?php echo $current_user['screen_name']; ?></li>
                <li>Location : <?php //echo $branchs[0]['name']?></li>
				<li><a href="<?php echo base_url(); ?>" target="_blank"><?php echo lang('ionize_website'); ?></a></li>
				<li><a href="<?php echo base_url().Settings::get_lang('current').'/'.config_item('admin_url'); ?>/user/logout"><?php echo lang('ionize_logout'); ?></a></li>
				<li>
					<?php foreach(Settings::get('displayed_admin_languages') as $lang) :?>
						<a href="<?php echo base_url().$lang; ?>/<?php echo config_item('admin_url'); ?>"><img src="<?php echo theme_url(); ?>images/world_flags/flag_<?php echo $lang; ?>.gif" alt="<?php echo $lang; ?>" /></a>
					<?php endforeach ;?>
				</li>
			</ul>
		</div>
	</div>
</div>

<div id="desktopNav" class="desktopNav">

	<div class="toolMenu left">

		<ul>
			<li><a class="navlink" href="dashboard" title="<?php echo lang('ionize_title_welcome'); ?>"><?php echo lang('ionize_menu_dashboard'); ?></a></li>
			
            
			<li><a class="returnFalse"><?php echo lang('ionize_menu_settings'); ?></a>
				<ul>
					<li><a class="navlink" href="setting/ionize" title="<?php echo lang('ionize_menu_ionize_settings'); ?>"><?php echo lang('ionize_menu_ionize_settings'); ?></a></li>
					<li><a class="navlink" href="lang" title="<?php echo lang('ionize_menu_languages'); ?>"><?php echo lang('ionize_menu_languages'); ?></a></li>
					<?php  if($this->connect->has_permission('users')) : ?>
						<li><a class="navlink" href="users" title="<?php echo lang('ionize_menu_users'); ?>"><?php echo lang('ionize_menu_users'); ?></a></li>
					<?php endif ;?>
					<?php  if($this->connect->has_permission('users')) : ?>
						<li><a class="navlink" href="setting/themes" title="<?php echo lang('ionize_title_theme'); ?>"><?php echo lang('ionize_menu_theme'); ?></a></li>
					<?php endif ;?>
					<li class="divider"><a class="navlink" href="setting" title="<?php echo lang('ionize_menu_site_settings'); ?>"><?php echo lang('ionize_menu_site_settings'); ?></a></li>
					<?php  if($this->connect->has_permission('users')) : ?>
						<li><a class="navlink" href="setting/technical" title="<?php echo lang('ionize_menu_site_settings_technical'); ?>"><?php echo lang('ionize_menu_site_settings_technical'); ?></a></li>
					<?php endif ;?>
				</ul>
			</li>
		</ul>
	</div>
	
	<div id="desktopNavToolbar_spinner" class="spinner"></div>

</div>


</div>

<script type="text/javascript">
	
	/**
	 * Init of all main menu links
	 *
	 */
	$$('.navlink').each(function(item)
	{
		item.addEvent('click', function(event)
		{
			event.preventDefault();

			ION.contentUpdate({
            	element : 'mainPanel',
                url: this.getProperty('href'),
				title: this.getProperty('title')
			});
		});
	});

	if ($('mediamanagerlink'))
	{
		$('mediamanagerlink').addEvent('click', function(event)
		{
			event.preventDefault();

			ION.contentUpdate({
				element: 'mainPanel',
				url: this.getProperty('href'),
				title: this.getProperty('title'),
				padding: {top: 0, right: 0, bottom: 0, left: 0}
			});
		});
	}

	$('aboutLink').addEvent('click', function(event)
	{
		event.preventDefault();

		new MUI.Modal({
			id: 'about',
			title: 'MUI',
			content: {url: admin_url + 'desktop/get/system/about'},
			type: 'modal2',
			width: 360,
			height: 210,
			padding: {top: 70, right: 12, bottom: 10, left: 22},
			scrollbars: false
		});
	});
	
</script>

